package com.xtwy.qrcodescan.net;

import android.util.Log;

import com.lzy.okgo.OkGo;
import com.xtwy.qrcodescan.callbck.JsonCallback;

import java.util.Map;

/*
 * -----------------------------------------------------------------
 * Copyright (C) 2018-2030, by your company, All rights reserved.
 * -----------------------------------------------------------------
 * 文    件: OkUtil.java
 * 作    者: 侯建军
 * 版    权: 1.0.0
 * 描    述:
 * 创建时间: 2018/9/14 17:39
 * 更新时间：2018/9/14 17:39
 * -----------------------------------------------------------------
 * 2018/9/14 17:39: 创建 OkUtil.java (侯建军);
 * -----------------------------------------------------------------
 */
public class OkUtil  {
    /**
     *
     * @param url
     * @param tag
     * @param map
     * @param callback
     * @param <T>
     */
    public static <T> void getRequets(String url, Object tag, Map<String, String> map, JsonCallback<T> callback) {
        Log.d("OkGoUtil", "method get");
        OkGo.<T>get(url)
                .tag(tag)
                .params(map)
                .execute(callback);
    }
    public static <T> void postRequest(String url, Object tag, Map<String, String> map, JsonCallback<T> callback) {
        Log.d("OkGoUtil", "method post");
        OkGo.<T>post(url)
                .tag(tag)
                .params(map)
                .execute(callback);
    }
}
